<template>
    <el-button 
        v-bind="$attrs"
        @click="myButtonClick($event)"
        >
        <slot></slot>
    </el-button>
</template>

<script>
    export default {
        data(){
            return {

            }
        },
        props:{
        },
        methods:{
            myButtonClick(el){
                //点击按钮后让其失焦--防止按回车键和空格键触发所对应的方法
                let target = el.target
                if (target.nodeName == "I" || target.nodeName == "SPAN") target = el.target.parentNode
                target.blur()
                this.$emit('btnClick')
            },
        }
    }
</script>
